#ifndef ___X_ROOM_MGR_H___
#define ___X_ROOM_MGR_H___

#include "map/MapMgr.h"

class CRoom
	: public xObjBase
{
public:
	enum _eRoomState
	{
		RS_INIT = 0,
		RS_LOAD,
		RS_CLOSE,
		RS_DELETE,
		RS_END
	};

	CRoom(U32 room_type,U64 guid);
	void LoadLevel();
protected:
	CMapMgr* m_pMapMgr;
	DECLARE_VAR(U32, m_nLevelID);
	DECLARE_VAR(CRoom::_eRoomState, m_eRoomState);
	DECLARE_VAR(U32, WIDE_BOSS_INDEX);
};


#if defined(CLIENT_TYPE)
typedef std::map<U64, CRoom*>	RoomList;
typedef std::map<U32, RoomList*>		LevelRoomList;
#else
typedef boost::unordered_map<U64, CRoom*>			RoomList;
typedef boost::unordered_map<U32, RoomList*>		LevelRoomList;
#endif

class CRoomMgr
{
	SINGLETON_CLASS(CRoomMgr)
	CRoomMgr();
	~CRoomMgr();
public:
	CRoom* CreateRoom(U32 nLevelID, BOOL bStatic = FALSE);
	RoomList* GetRoomsByLevelID(U32 nLevelID);

protected:
	void Clear();

protected:
	LevelRoomList		m_allRooms;
};

#endif//___X_ROOM_MGR_H___